<h1 id="for-循环">for 循环</h1>
<h3 id="示例">示例</h3>
<pre><code class="hljs language-javascript"><span class="hljs-title function_">println</span>(<span class="hljs-string">&quot;demo1 ================&quot;</span>)
<span class="hljs-keyword">for</span> a = <span class="hljs-number">0</span>; a &lt; <span class="hljs-number">5</span>; a++ {
    <span class="hljs-title function_">println</span>(<span class="hljs-string">&quot;current value:&quot;</span>, a)
}

<span class="hljs-title function_">println</span>(<span class="hljs-string">&quot;demo2 ================&quot;</span>)
arr = [<span class="hljs-number">1</span>, <span class="hljs-literal">false</span>, <span class="hljs-literal">true</span>, <span class="hljs-number">3.14</span>, <span class="hljs-string">&quot;changlie&quot;</span>]
<span class="hljs-keyword">for</span> a = <span class="hljs-number">0</span> ; a &lt; arr.<span class="hljs-title function_">size</span>(); a++ {
    <span class="hljs-title function_">println</span>(<span class="hljs-string">&quot;current value:&quot;</span>, arr[a])
}
</code></pre>
<h3 id="while">while</h3>
<p>Quick的for循环与golang的很像。<br>在Quick中，for可以像while语句一样使用：</p>
<pre><code class="hljs language-javascript">i = <span class="hljs-number">0</span>
<span class="hljs-keyword">for</span> i&lt;<span class="hljs-number">9</span> {
    <span class="hljs-title function_">println</span>(<span class="hljs-string">&quot;i is&quot;</span>, i)
    i++
}
</code></pre>
<p>输出</p>
<pre><code>i is 0
i is 1
i is 2
i is 3
i is 4
</code></pre>
<h3 id="死循环">死循环</h3>
<p>死循环可以简写为如下方式：</p>
<pre><code class="hljs language-javascript"><span class="hljs-keyword">for</span> {
    <span class="hljs-title function_">println</span>(<span class="hljs-string">&quot;it&#x27;s a dead loop&quot;</span>)
}
</code></pre>
